/*******************************************************************************
 * Copyright (c) 2010, 2017 西安秦晔信息科技有限公司
 * Licensed under the Apache License, Version 2.0 (the "License");
 *    you may not use this file except in compliance with the License.
 *    You may obtain a copy of the License at
 *
 *       http://www.apache.org/licenses/LICENSE-2.0
 *
 *    Unless required by applicable law or agreed to in writing, software
 *    distributed under the License is distributed on an "AS IS" BASIS,
 *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *    See the License for the specific language governing permissions and
 *    limitations under the License.
 *******************************************************************************/
package com.qinyeit.serviceapp.entity.enums;

import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.StringUtils;

/**
 * 打印单据类型(业务数据区别较大的, 可当成新的单据模块来处理, 类似的归入一类统一处理)
 * @author mafeiyue
 * @date 2018-07-05
 */
@JsonFormat(shape = JsonFormat.Shape.OBJECT)
public enum PrintSettingOrderType {

    PURCHASEORDER("总部订单"),
    STOREIN("总部入库"),
    STOREOUT("总部出库"),
    TRANSFERORDER("总部调拨");
//    INVENTORYORDER(4, "总部盘点");


//    private final Integer index;
    private final String text;

    private PrintSettingOrderType(String text) {
//        this.index = index;
        this.text = text;
    }

    public String getKey() {
        return this.toString();
    }

    public String getText() {
        return text;
    }

   /* public Integer getIndex() {
        return index;
    }
*/

    public static PrintSettingOrderType getByString(String paramName){
        if(StringUtils.isBlank(paramName)){
            return null;
        }
        paramName = paramName.trim().toUpperCase();

        if ("PURCHASEORDER".equalsIgnoreCase(paramName)) { return PURCHASEORDER; }
        if ("STOREIN".equalsIgnoreCase(paramName)) { return STOREIN; }
        if ("STOREOUT".equalsIgnoreCase(paramName)) { return STOREOUT; }
        if ("TRANSFERORDER".equalsIgnoreCase(paramName)) { return TRANSFERORDER; }
//        if ("INVENTORYORDER".equalsIgnoreCase(paramName)) { return INVENTORYORDER; }

        return null;
    }

}
